<%@ page language="java" pageEncoding="utf-8"%>
<%--<%@ page import="java.util.*"%>--%>
<%--<%@ page import="cn.gov.mwr.common.common.Constant,cn.gov.mwr.common.usermanage.bean.UserInfo,cn.gov.mwr.common.organizationmanage.control.OrgControlImpl,cn.gov.mwr.common.organizationmanage.bean.OrganizationInfo"%>--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="<%=request.getContextPath() %>"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=7"/>
    <%--<link rel="stylesheet" type="text/css" href="${ctx}/wendang/comhtml/css/tab.css">--%>
    <script type="text/javascript" src="${ctx}/js/jquery-1.4.2.js"></script>
    <title></title>

</head>
<body oncopy="alert('对不起，禁止复制！');return false;">


<%
    String name=(String)session.getAttribute("name");
    String password=(String )session.getAttribute("password");
%>




<script type="text/javascript">

    var url = "${ctx}/servlet/userAct";
    $(document).ready(function(){
        var name = "<%=name%>";
        var password="<%=password%>"
        $.ajax({
            url: url+"?act=to_updateBefore&name="+name+"&password="+password,
            type: "POST",
            success: function(data) {
                $.ajax({
                    url: url+"?act=to_updateBefore2&ucode="+data,
                    type: "POST",
                    success: function(data) {
                        var html="";
                        var html1="";
                        var  temp=data.split(":");
                        html+="<div id='password'>"+"<label style='font-weight: bold;font-size: 15px'><strong>用户名:</strong></lable>"+"<input disabled='disabled' style='margin-left: 22px' type='text' value='"+temp[0]+"'>"+"</div><br/>";

                        html+="<div id='userInfo'>"+"<label style='font-weight: bold;font-size: 15px'><strong>密码:</strong></label>"+"<input style='margin-left: 40px'  disabled='disabled' type='text' value='"+temp[1]+"'>"+"</div><br/>";

                        html+="<div id='uname'>"+"<label style='font-weight: bold;font-size: 15px'><strong>新用户名:</strong></label>"+"<input style='margin-left: 10px' id='name' name='user' type='text'>"+"</div><br/>";
                        html+="<div id='password'>"+"<label style='font-weight: bold;font-size: 15px'><strong>更改密码:</strong></label>"+"<input style='margin-left: 10px' id='pwd' type='password'>"+"</div><br/>";
                        html+="<div id='password'>"+"<label style='font-weight: bold;font-size: 15px'><strong>确认密码:</strong></label>"+"<input style='margin-left: 10px' id='pwdAgain' type='password'>"+"</div></div>";
                        html1+="<div id='update' style='margin-left: 40px;margin-top: 20px'>"+"<input type='button' id='yes' value='确&nbsp&nbsp认' onclick='dwUpdate(this)' name='"+name+"'>";
                        html1+="<input type='button' style='margin-left: 40px' value='重&nbsp&nbsp置' onclick='dwResert(this)' id='resert'>"+"</div>";
                        $("#self").append(html);
                       $("#self1").append(html1);
                    }

                });
            }

        });


    })


</script>


<div id="editSelf" >
    <div id="title" style="margin-bottom: 20px;margin-left:180px;margin-top: 50px"><Strong>用户信息修改</Strong></div>
    <div id="self" style="margin-left: 100px">

    </div>
     <div id="self1" style="margin-left: 100px">

     </div>

</div>

<script type="text/javascript">
    var url = "${ctx}/servlet/userAct";
    function dwUpdate(editOne){
        var xinZhi=document.getElementById("name").value;
        var pwd=document.getElementById("pwd").value;
        var newps= document.getElementById("pwd").value
        var oldps= document.getElementById("pwdAgain").value

        var temp1= $.trim(newps);
        var temp2= $.trim(oldps);
        if(document.getElementById("name").value == "" || document.getElementById("pwd").value == "") {
            alert("用户名或密码不能为空");
            document.getElementById("name").focus();
        }else if(temp1!=temp2){

            alert("两次输入的密码不一致，请重新输入");
            $("#pwd") .val("");
            $("#pwdAgain") .val("");
            document.getElementById("pwd").focus();
        }
        else{

            $.ajax({
                url: url+"?act=to_updateInfo&name="+editOne.name+"&xinZhi="+xinZhi+"&password="+pwd,
                type: "POST",
                success: function() {

                    alert("修改成功！");
                    location.reload();
                }
            });
        }

    }

    function dwResert(){

        $("#name") .val("");
        $("#pwd") .val("");
        $("#pwdAgain") .val("");
        $("#name").focus();
    }

</script>

</body>
</html>
